Learning Objectives

After completing this lesson, you’ll be able to:

Instructions

In this lesson, you will:

Resources

Terminology

Feature connection lines
These lines connect feature types and transformers on the canvas and control the flow of features from left to right.

Schema Mapping

Once you have edited a writer feature type schema, you have to map the old schema onto the new schema. This step involves changing the names, data types, etc., of your attributes to ensure they match the new schema.

FME uses colored ports on expanded writer feature types to indicate the status of schema mapping.

Scenario

Jennifer

Now that Jennifer has created a workspace that edits the web data’s schema, she must map it, specifying how the original and new schemas are related.

1) Start FME Workbench

2) Add an AttributeManager

We must map the new schema onto the old one to ensure our new first_name attribute gets the same values as the existing First attribute. We can use the AttributeManager transformer for that.

3) Map Schema with an AttributeManager

The AttributeManager parameters are a table that defines how to modify attributes. It allows you to create new attributes, edit existing attribute names, reorder them, and set their values. All transformers have parameters that control their operation. These parameters are unique to each transformer. We can use this transformer to change incoming features so their schema matches the writer feature type.

Removing attributes using AttributeManager

Next, we can rename our attributes. 

Renaming First to first_name

Move Up button

Your dialog should looks like this:

Setting AttributeManager parameters

4) Automatic Attribute Definition Mode

In the previous lesson, we mentioned that we could use Automatic or Manual Attribute Definition mode on the feature type. We used Manual, defined the schema we wanted, and then mapped it using the AttributeManager.

That's a valid approach, but let's look at a faster alternative: Automatic mode.

The Attribute Definition mode is currently set to Manual.

Choosing Automatic attribute definition mode

The schema is the same in this case because we already mapped it using the AttributeManager. But consider: it would have also worked to change this to Automatic and use the AttributeManager without defining the destination schema in Manual mode. The only major downside is that FME has to infer the attribute types, so you need to check them. In this case, they are all text and set correctly, so it works well.

After changing to Automatic mode, we could click Manual again to make changes.

However, we will leave it in Automatic mode.

We haven't run the workspace yet; in the next lesson, we'll use a technique called partial runs to do that.

Optional Challenge

Test Automatic mode by changing your AttributeManager parameters. Rename an attribute, for example. You will see the change reflected in the writer feature type schema automatically. 

Make sure to undo your change after testing.

Leave Us Feedback on This Lesson